package com.example.t1;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {
    Button but_ranin;
    Button but_light;
    int r;
    int l;
    ProgressBar p_rain;
    ProgressBar p_light;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        p_rain = findViewById(R.id.rain);
        p_light = findViewById(R.id.light);
        p_rain.setBackgroundColor(Color.WHITE);
        p_rain.setDrawingCacheBackgroundColor(Color.RED);
        but_ranin = findViewById(R.id.but_rain);
        but_light=findViewById(R.id.but_light);


        but_ranin.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(MainActivity.this,"rain",Toast.LENGTH_SHORT).show();
                r=r+50;
                p_rain.setProgress(r);
                if(r>4096){r=0;   }
                startActivity(new Intent(MainActivity.this,rain_activity.class));

            }
        });
        but_light.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(MainActivity.this,"light",Toast.LENGTH_SHORT).show();
                l=l+50;
                p_light.setProgress(l);
                if(l>4096){l=0;   }
                startActivity(new Intent(MainActivity.this,Light_activity.class));
            }
        });
    }


}